package com.rcdz.mykotlindemo.view.activity

import android.view.View
import androidx.fragment.app.FragmentTransaction
import com.rcdz.mykotlindemo.R
import com.rcdz.mykotlindemo.view.fragment.FragmentStart
import com.wjt.mylibrary.base.BaseActivity


/**
 * 这是fragment菜单
 */
class FragmentMenuActivity :BaseActivity(){
    lateinit var transaction: FragmentTransaction
    override fun initView() {
        var aa = FragmentStart.newInstance()
        transaction = supportFragmentManager.beginTransaction()
        transaction.add(R.id.main_content, FragmentStart())
        transaction.addToBackStack("FragmentStart")
        transaction.commit()
    }

    override fun initData() {
    }

    override fun setNowActivityName(): String {
        return "FragmentMenuActivity"
    }

    override fun setLayout(): Int {
        return R.layout.activity_fragment_menu
    }

    override fun onClick(v: View?) {
    }

    override fun onBackPressed() {
        if(supportFragmentManager.backStackEntryCount == 1){
            super.onBackPressed()
        }else{
            supportFragmentManager.popBackStack()
        }
    }

}
